import { UserLayout } from '@/layout'
import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router'

const basicRoutes: RouteRecordRaw[] = [
  {
    path: '/',
    component: UserLayout,
    redirect: '/login',
    children: [
      {
        path: '/login',
        component: () => import('@/pages/user/login'),
        meta: { title: '登录' },
      },
      {
        path: '/reset',
        component: () => import('@/pages/user/reset'),
      },
    ],
  },
  {
    path: '/404',
    component: () => import('@/pages/error/404'),
  },
  {
    path: '/:pathMatch(.*)*',
    redirect: '/404',
  },
]

const router = createRouter({
  history: createWebHashHistory(),
  routes: [...basicRoutes],
})

export default router
